#include <fstream>
#include <sstream>
#include <string>

#include "common.h"

string read_file_to_string(string &file_path)
{
    std::ifstream file(file_path, std::ios::in);
    std::stringstream buffer;
    std::string result = "";

    if (file)
    {
        buffer << file.rdbuf(); // 将文件内容读入buffer
        file.close();

        result = buffer.str();
    }
    else
    {
        std::cout << "无法打开文件" << std::endl;
    }

    return result;
}

